<template>
  <a-select v-bind="{...$props, ...$attrs}">
    <a-select-option v-for="item in options" :key="item.id"
                     :value="item.id">
      {{item.dataSourceName}}
    </a-select-option>
  </a-select>
</template>
<script setup>
import { onMounted, shallowRef } from "vue";
import { defHttp } from "@/utils/http/axios";

const props = defineProps({
  value: {
    type: String,
    default: undefined
  }
})
defineOptions({ name: "DataSourceSelect" });
onMounted(() => {
  loadDataSource();
});
const options = shallowRef([]);

function loadDataSource() {
  defHttp.get({
    url: "/cwqs/cwqsDataSource/list",
    params: { pageNo: 1, pageSize: 1000 }
  }, { joinParamsToUrl: true }).then(data => {
    options.value = data.records;
  });
}
</script>
